<template>
    <div class="box">
        <button @click="changeLang('EN')">英文</button>
        <button @click="changeLang('CN')">中文简体</button>
        <div>{{ $t("home.title") }}</div>
    </div>
</template>

<script setup lang='ts'>
    import { useI18n } from "vue-i18n";
    const { locale } = useI18n();
    const changeLang = (val:any) => {
        locale.value = val;
        localStorage.setItem("lang", val);
    };
</script>

<style lang='less' scoped>
    .box{
        border: 1px solid black;
    }
</style>